import request from '../utils/request'



export const login = (user) => {
  return request({
    url: '/v1_0/authorizations',
    method: 'POST',
    data: user
  })
}

export const getProfile = () => {
  return request({
    method: 'GET',
    url: 'v1_0/user/profile',
    headers: {
      Authorization: 'Bearer f50fdbaf-c5e3-42d3-9d12-94c545370ad3'
    }
  })
}
// 关注
export const attention = (userId) => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target: userId
    }
  })
}
// 取关
export const offAttention = (userId) => {
  return request({
    url: '/v1_0/user/followings/' + userId,
    method: 'DELETE'
  })
}
// 获取用户自已的信息
export const getInfo = () => {
  return request({
    method: 'GET',
    url: 'v1_0/user'
  })
}
// 编辑用户信息
export const updateUserInfo = (data) => {
  return request({
    method: 'PATCH',
    url: 'v1_0/user/profile',
    data
  })
}
// 修改头像
export const updateUserPhoto = fd => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    data: fd
  })
}
// 修改性别
export const uppdateUsergender = gender => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    gender
  })
}
